<template>
	<view class="user-layout">
		<template v-if="newsLookList.length">
			<new-item @tap="handleToDetail(item)" :newInfo="item" v-for="item in newsLookList" :key="item.id" />
		</template>
		<u-empty
		        v-else
		        mode="data"
		        icon="/static/icon/empty.png"
		/>
	</view>
</template>

<script setup>
import { useNewLookHistory } from '@/store/history.js'	
const newStore = useNewLookHistory()
const { newsLookList } = toRefs(newStore)
// 跳转
	const handleToDetail = (newObject)  => {
		let { id,classid: cid } = newObject
		uni.navigateTo({
			url:'/pages/detail/detail?id=' + id + '&cid=' + cid,
			success: () => {
				newStore.setNewsLog(newObject)
			},
			fail: () => {
				uni.showModal({
					title: '数据获取失败，无法跳转',
					showCancel: false
				})
			}
		})
	}
</script>

<style lang="scss">
.user-layout {
	height: 100vh;
	width: 100vw;
}
</style>
